﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace RCREEE.Library.Entities
{
    public class EnergyConsumptionDevelopmentItemValue
    {
        #region Private fields

        private int _itemId;
        private string _englishItemName;
        private string _englishDescription;

        private string _frenchItemName;
        private string _frenchDescription;

        private string _arabicItemName;
        private string _arabicDescription;

        private int _countryId;
        private string _countryName;

        private int _parentItemId;
        private string _parentItemName;

        private int _languageCode;

        private bool _isMajor;

        private List<ItemValue> _itemValues;

        #endregion

        #region Public properties

        public int ItemId
        {
            get { return _itemId; }
            set { _itemId = value; }
        }
        public string EnglishItemName
        {
            get { return _englishItemName; }
            set { _englishItemName = value; }
        }
        public string EnglishDescription
        {
            get { return _englishDescription; }
            set { _englishDescription = value; }
        }

        public string FrenchItemName
        {
            get { return _frenchItemName; }
            set { _frenchItemName = value; }
        }
        public string FrenchDescription
        {
            get { return _frenchDescription; }
            set { _frenchDescription = value; }
        }

        public string ArabicItemName
        {
            get { return _arabicItemName; }
            set { _arabicItemName = value; }
        }
        public string ArabicDescription
        {
            get { return _arabicDescription; }
            set { _arabicDescription = value; }
        }

        public int ParentItemId
        {
            get { return _parentItemId; }
            set { _parentItemId = value; }
        }
        public string ParentItemName
        {
            get { return _parentItemName; }
            set { _parentItemName = value; }
        }

        public int CountryId
        {
            get { return _countryId; }
            set { _countryId = value; }
        }
        public string CountryName
        {
            get { return _countryName; }
            set { _countryName = value; }
        }

        public int LanguageCode
        {
            get { return _languageCode; }
            set { _languageCode = value; }
        }

        public bool IsMajor
        {
            get { return _isMajor; }
            set { _isMajor = value; }
        }

        public List<ItemValue> ItemValues
        {
            get { return _itemValues; }
            set { _itemValues = value; }
        }

        #endregion

        #region Constructors

        public EnergyConsumptionDevelopmentItemValue()
        {
            ItemValues = new List<ItemValue>();
        }

        #endregion

        #region Private Methods
        

        #endregion

        #region Public Methods

        #region Select


        /// <summary>
        /// Gets all Master EnergyConsumptions' Data 
        /// </summary>
        /// <returns>DataTable contains Master Data Id,Name,ParentId, ParentName</returns>
        public DataTable GetAllMasterEnergyConsumptions(int LanguageCode,int ExceptionItemId)
        {
            return DataManager.GetAllMasterEnergyConsumptions(LanguageCode, ExceptionItemId);
        }

        public EnergyConsumptionDevelopmentItemValue GetOneEneregyConsumptionItemValue(int itemId,int countryId)
        {
            return DataManager.GetOneObjEneregyConumptionById(itemId, countryId);
        }

        public DataTable GetOneMasterEnergyConsumptionById(int itemId,int LanguageCode)
        {
            return DataManager.GetOneMasterEneregyConsumptionById(itemId, LanguageCode);
        }

        public DataTable GetOneEneregyConsumptionValuesById(int ItemId, int CountryId)
        {
            return DataManager.GetOneEneregyConsumptionValuesById(ItemId, CountryId);
        }

        public DataTable GetAllEnergyConsumptionDevelopmentItemValues(int LanguageCode, int CountryId)
        {
            return DataManager.GetAllEnergyConsumptionDevelopmentItemValues(LanguageCode, CountryId);
        }

        public string GetSingleGetSingleEnergyConsumptionItemValue(int ItemId, int CountryId, int Year)
        {
            return DataManager.GetSingleEnergyConsumptionItemValue(ItemId, CountryId, Year);
        }

        #endregion

        #region Update

        public bool UpdateMasterEnergyConsumption(EnergyConsumptionDevelopmentItemValue _energy)
        {
            return DataManager.UpdateMasterEnergyConsumptions(_energy);
        }

        public bool UpdateEnergyConsumptionItemValues()
        {
            return DataManager.UpdateEnergyConsumptionItemValues(this);
        }

        #endregion

        #region Insert

        public bool Insert(EnergyConsumptionDevelopmentItemValue _energy)
        {
            return DataManager.InsertMasterEnergyConsumptions(_energy);
        }

        #endregion

        #region Delete

        public bool DeleteEnergyConsumptionDevelopmentItem(EnergyConsumptionDevelopmentItemValue _energy)
        {
            return DataManager.DeleteMasterEnergyConsumptions(_energy.ItemId);
        }
        #endregion

        #region General Methods
        public List<int> GetEnergyConsumptionDevelopmentYears()
        {
            return null;
        }

        #endregion

        #endregion

        #region Overrides

        public override string ToString()
        {
            return EnglishItemName;
        }

        #endregion

    }

    public struct ItemValue
    {
        public int Year { get; set; }

        public string Value { get; set; }
    }
}

